package com.film.admincontroller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.film.service.ShowingsService;
import com.film.service.impl.ShowingsServiceImpl;
/**
 * 该控制类用来做电影排期的删除
 * @author 2119196781
 *
 */
@WebServlet("/deleteFilmShowings.do")
public class DeleteFilmShowingsController extends HttpServlet{
	private ShowingsService showingsService = new ShowingsServiceImpl();
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession();
		String showingsId = request.getParameter("showingsId");
		
		//删除
		int result = 0;
		try {
			result = showingsService.deleteFilmShowings(Integer.parseInt(showingsId));
			if(result == 1) {
				response.sendRedirect("/film/filmShowings.do");
			}
		}catch (Exception e) {
			session.setAttribute("showingsMsg","该排期暂时删除不了");
			response.sendRedirect("/film/filmShowings.do");
		}
		
	}
}
